package com.ymatou.iapi.usersafe.testcase;

import java.io.IOException;
import java.util.Date;

import org.apache.http.client.ClientProtocolException;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.JUserCallService;
import com.ymttest.database.model.NameList;
import com.ymttest.database.sqlwapper.UserSafeWapper;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.YMTDateUtil;
import com.ymttest.utils.constant.ECode;
import com.ymatou.iapi.userregister.parameter.UserRegisterInfoRequestDtoBean;
import com.ymatou.iapi.userregister.service.UserRegisterInfoRequestDtoCall;
import com.ymatou.iapi.usersafe.parameter.*;
import com.ymatou.iapi.usersafe.service.*;

/**
 * 黑白名单风控认证 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_VerifyNameList {
	private static VerifyBean verifyBean;
	private static VerifyCall verifyCall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("黑白名单风控认证");
	}

	@Before
	public void caseUp() {
		verifyBean = new VerifyBean();
		verifyCall = new VerifyCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(verifyCall.getOpurl() + ":VerifyNameList");
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	/**
	 * 开启黑白名单相关开关 关闭其他风控开关
	 * 
	 * @throws InterruptedException
	 * @throws ClientProtocolException
	 * @throws IOException
	 */
	public void initConfig() throws InterruptedException, ClientProtocolException, IOException {
		UserSafeWapper userSafeWapper = new UserSafeWapper();

		// 默认风控开关 dimension_strategy:checkOtherUserTypeLoginAuth=true
		userSafeWapper.updateRiskStrategyStatus(0, "DefaultSafeVerifyStrategy");
		// 买家设备号黑名单 dimension_strategy:deviceIdAllowNull=true
		userSafeWapper.updateRiskStrategyStatus(2, "BuyerDeviceIdBlacklistVerifyStrategy");
		// 买家ip区域认证(买家是否在此区域认证过)
		userSafeWapper.updateRiskStrategyStatus(0, "BuyerIpAreaVerifyStrategy");
		// 买家ip黑名单列表(该ip是否在黑名单中) dimension_strategy:
		// loginSuccessLimit=5
		// loginSuccessLimitMinutes=2
		// loginFailLimit=3
		// loginFailLimitMinutes=1
		// lockExpiredMinutes=10
		userSafeWapper.updateRiskStrategyStatus(2, "BuyerIpBlacklistVerifyStrategy");
		// 买家登入次数黑名单 dimension_strategy:
		// rangMinutes=1
		// countLimit=5
		userSafeWapper.updateRiskStrategyStatus(0, "BuyerLoginCountVerifyStrategy");
		// 买家登入密码错误次数 dimension_strategy:
		// rangMinutes=1
		// countLimit=5
		userSafeWapper.updateRiskStrategyStatus(0, "BuyerLoginPasswordFailTimesVerifyStrategy");
		// 买家常用设备号认证 dimension_strategy:deviceIdAllowNull=true
		userSafeWapper.updateRiskStrategyStatus(0, "BuyerOftenDeviceIdVerifyStrategy");
		// 买家token认证
		userSafeWapper.updateRiskStrategyStatus(0, "BuyerTokenVerifyStrategy");
		// 买手设备号黑名单 dimension_strategy:deviceIdAllowNull=true
		userSafeWapper.updateRiskStrategyStatus(2, "SellerDeviceIdBlacklistVerifyStrategy");
		// 买手ip区域认证
		userSafeWapper.updateRiskStrategyStatus(0, "SellerIpAreaVerifyStrategy");
		// 买手ip黑名单 dimension_strategy:
		// loginSuccessLimit=5
		// loginSuccessLimitMinutes=2
		// loginFailLimit=3
		// loginFailLimitMinutes=1
		// lockExpiredMinutes=10
		userSafeWapper.updateRiskStrategyStatus(2, "SellerIpBlacklistVerifyStrategy");
		// 买手登入次数 dimension_strategy:
		// rangMinutes=1
		// countLimit=5
		userSafeWapper.updateRiskStrategyStatus(0, "SellerLoginCountVerifyStrategy");
		// 买手登入密码错误次数 dimension_strategy:
		// rangMinutes=1
		// countLimit=5
		userSafeWapper.updateRiskStrategyStatus(0, "SellerLoginPasswordFailTimesVerifyStrategy");
		// 买手常用设备号验证 dimension_strategy:deviceIdAllowNull=true
		userSafeWapper.updateRiskStrategyStatus(0, "SellerOftenDeviceIdVerifyStrategy");
		// 买手token验证
		userSafeWapper.updateRiskStrategyStatus(0, "SellerTokenVerifyStrategy");
		// 买手登录ID黑名单
		userSafeWapper.updateRiskStrategyStatus(2, "SellerLoginIdBlackListVerifyStrategy");
		// 买家登录ID黑名单
		userSafeWapper.updateRiskStrategyStatus(2, "BuyerLoginIdBlackListVerifyStrategy");
		// 登入频次加入黑名单
		userSafeWapper.updateRiskStrategyStatus(0, "BuyerLoginCountVerifyStrategy");
		userSafeWapper.updateRiskStrategyStatus(0, "SellerLoginCountVerifyStrateg");
	}

	private VerifyBean initSellerVerify(VerifyBean vb, UserRegisterInfoRequestDtoBean urb, Integer uid) {
		vb.setAppId("sellerapp");
		vb.setAppSource("sellerapp");
		vb.setClientIp(urb.getClientIp());
		vb.setDeviceId(urb.getDeviceId());
		vb.setLoginId(urb.getLoginId());
		vb.setUserId(uid);
		return vb;
	}

	public VerifyBean initVerify(VerifyBean vb, UserRegisterInfoRequestDtoBean urb, Integer uid) {
		vb.setAppId("app");
		vb.setAppSource("app");
		vb.setClientIp(urb.getClientIp());
		vb.setDeviceId(urb.getDeviceId());
		vb.setLoginId(urb.getLoginId());
		vb.setUserId(uid);
		return vb;
	}

	/**
	 * @see #insertNameList(int, int, int, String, Date, Date)
	 * @param ListType
	 * @param NameType
	 * @param ScopeType
	 * @param name
	 */
	private void insertNameList(int ListType, int NameType, int ScopeType, String name) {
		UserSafeWapper wapper = new UserSafeWapper();
		NameList namelist = new NameList();
		namelist.setCreateTime(YMTDateUtil.getDate());
		namelist.setStartTime(YMTDateUtil.getDate(YMTDateUtil.getBeforeOrNextDay(-1, YMTDateUtil.YMDTHMSS_STRING), YMTDateUtil.YMDTHMSS_STRING));
		namelist.setEndTime(YMTDateUtil.getDate(YMTDateUtil.getBeforeOrNextDay(1, YMTDateUtil.YMDTHMSS_STRING), YMTDateUtil.YMDTHMSS_STRING));
		namelist.setLastUpdateTime(YMTDateUtil.getDate());
		namelist.setCreator("autotest");
		namelist.setName(name);
		namelist.setNameType(NameType);
		namelist.setScopeType(ScopeType);
		namelist.setListType(ListType);
		wapper.insertNameList(namelist);
	}

	/**
	 * 插入新风控规则 <br>
	 * Id int 11 否 主键 <br>
	 * Name varchar 150 否 名称 ip 或 设备号等，指名称类型中所对应的业务值<br>
	 * ListType int 11 否 名单类型 如：：1：白名单，2：黑名单<br>
	 * NameType int 11 否 名称类型 如：1：用户编号，2：登录名，3：IP ，4：设备号<br>
	 * ScopeType int 11 否 作用域类型 如：0： 全局范围，1：买家，2：买手<br>
	 * StartTime datetime 0 否 有效期开始时间 <br>
	 * EndTime datetime 0 否 有效期结束时间 <br>
	 * CreateTime datetime 0 否 记录创建时间 <br>
	 * LastUpdateTime datetime 0 否 记录最后一次更新时间 <br>
	 * Remark varchar 1000 是 备注 <br>
	 * Creator varchar 50 否 创建者<br>
	 * 
	 * @param namelist
	 * @return
	 */
	private void insertNameList(int ListType, int NameType, int ScopeType, String name, Date starttime, Date endtime) {
		UserSafeWapper wapper = new UserSafeWapper();
		NameList namelist = new NameList();
		namelist.setCreateTime(YMTDateUtil.getDate());
		namelist.setStartTime(starttime);
		namelist.setEndTime(endtime);
		namelist.setLastUpdateTime(YMTDateUtil.getDate());
		namelist.setCreator("autotest");
		namelist.setName(name);
		namelist.setNameType(NameType);
		namelist.setScopeType(ScopeType);
		namelist.setListType(ListType);
		wapper.insertNameList(namelist);
	}

	@Test
	@Category({ P1.class })
	@TestCase
	@Ignore
	// 用户编号没有黑名单
	public void Tc_VerifyNameList_001() {
		Logger.start(true, "用户编号买家黑名单#ListType2;NameType1;ScopeType1验证block");
		try {
			Logger.comment("前置条件准备");
			initConfig();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			UserSafeWapper usw = new UserSafeWapper();
			String name = uid.toString();
			insertNameList(2, 1, 1, name);
			// Thread.sleep(1000);
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(140, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("uid黑名单，执行身份认证", verifyCall.getAuthMessage(), "验证AuthMessage");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_VerifyNameList_002() {
		Logger.start(true, "登录名买家黑名单#ListType2;NameType2;ScopeType1验证block");
		try {
			Logger.comment("前置条件准备");
			initConfig();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			UserSafeWapper usw = new UserSafeWapper();
			String name = urb.getLoginId();
			insertNameList(2, 2, 1, name);
			// Thread.sleep(1000);
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(4700, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("登录ID黑名单", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyNameList_003() {
		Logger.start(true, "IP买家黑名单#ListType2;NameType3;ScopeType1验证block");
		try {
			Logger.comment("前置条件准备");
			initConfig();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			String name = urb.getClientIp();
			insertNameList(2, 3, 1, name);
			// Thread.sleep(1000);
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(140, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("IP黑名单，执行身份认证", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyNameList_004() {
		Logger.start(true, "设备号买家黑名单#ListType2;NameType4;ScopeType1验证block");
		try {
			Logger.comment("前置条件准备");
			initConfig();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			String name = urb.getDeviceId();
			insertNameList(2, 4, 1, name);
			// Thread.sleep(1000);
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(162, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("设备号黑名单，执行身份认证", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	@Ignore
	// 用户编号没有黑名单
	public void Tc_VerifyNameList_005() {
		Logger.start(true, "用户编号买手黑名单#ListType2;NameType1;ScopeType2验证block");
		try {
			Logger.comment("前置条件准备");
			initConfig();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setRegisterType(1);
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			UserSafeWapper usw = new UserSafeWapper();
			String name = uid.toString();
			insertNameList(2, 1, 2, name);
			// Thread.sleep(1000);
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(162, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("uid黑名单，执行身份认证", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyNameList_006() {
		Logger.start(true, "登录名买手黑名单#ListType2;NameType2;ScopeType2验证block");
		try {
			Logger.comment("前置条件准备");
			initConfig();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setRegisterType(1);
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			UserSafeWapper usw = new UserSafeWapper();
			String name = urb.getLoginId();
			insertNameList(2, 2, 2, name);
			// Thread.sleep(1000);
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(4700, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("登录ID黑名单", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyNameList_007() {
		Logger.start(true, "IP买手黑名单#ListType2;NameType3;ScopeType2验证block");
		try {
			Logger.comment("前置条件准备");
			initConfig();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setRegisterType(1);
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			UserSafeWapper usw = new UserSafeWapper();
			String name = urb.getClientIp();
			insertNameList(2, 3, 2, name);
			// Thread.sleep(1000);
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(140, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("IP黑名单，执行身份认证", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyNameList_008() {
		Logger.start(true, "设备号买手黑名单#ListType2;NameType4;ScopeType2验证block");
		try {
			Logger.comment("前置条件准备");
			initConfig();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setRegisterType(1);
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			UserSafeWapper usw = new UserSafeWapper();
			String name = urb.getDeviceId();
			insertNameList(2, 4, 2, name);
			// Thread.sleep(1000);
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(162, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("设备号黑名单，执行身份认证", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	@Ignore
	// 用户编号没有黑名单
	public void Tc_VerifyNameList_009() {
		Logger.start(true, "用户编号全局黑名单#ListType2;NameType1;ScopeType0验证block");
		try {
			Logger.comment("前置条件准备");
			initConfig();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setRegisterType(1);
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			UserSafeWapper usw = new UserSafeWapper();
			String name = uid.toString();
			insertNameList(2, 1, 0, name);
			// Thread.sleep(1000);
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(162, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("uid黑名单，执行身份认证", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyNameList_010() {
		Logger.start(true, "登录名全局黑名单#ListType2;NameType2;ScopeType0验证block");
		try {
			Logger.comment("前置条件准备");
			initConfig();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			UserSafeWapper usw = new UserSafeWapper();
			String name = urb.getLoginId();
			insertNameList(2, 2, 1, name);
			// Thread.sleep(1000);
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(4700, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("登录ID黑名单", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyNameList_011() {
		Logger.start(true, "IP全局黑名单#ListType2;NameType3;ScopeType0验证block");
		try {
			Logger.comment("前置条件准备");
			initConfig();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			String name = urb.getClientIp();
			insertNameList(2, 3, 0, name);
			// Thread.sleep(1000);
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(140, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("IP黑名单，执行身份认证", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyNameList_012() {
		Logger.start(true, "设备号全局黑名单#ListType2;NameType4;ScopeType0验证block");
		try {
			Logger.comment("前置条件准备");
			initConfig();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setRegisterType(1);
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			UserSafeWapper usw = new UserSafeWapper();
			String name = urb.getDeviceId();
			insertNameList(2, 4, 0, name);
			// Thread.sleep(1000);
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(162, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("设备号黑名单，执行身份认证", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	@Ignore
	// 用户编号白名单只有全局
	public void Tc_VerifyNameList_013() {
		Logger.start(true, "用户编号买家白名单#ListType1;NameType1;ScopeType1验证pass");
		try {
			Logger.comment("前置条件准备");
			initConfig();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			UserSafeWapper usw = new UserSafeWapper();
			String name = uid.toString();
			String logind = urb.getLoginId();
			insertNameList(2, 2, 1, logind);

			insertNameList(1, 1, 1, name);
			// Thread.sleep(1000);
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("安全认证通过", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyNameList_014() {
		Logger.start(true, "登录名买家白名单#ListType1;NameType2;ScopeType1验证pass");
		try {
			Logger.comment("前置条件准备");
			initConfig();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			UserSafeWapper usw = new UserSafeWapper();
			String name = urb.getLoginId();
			insertNameList(2, 2, 1, name);
			insertNameList(1, 2, 1, name);
			// Thread.sleep(1000);
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("安全认证通过", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyNameList_015() {
		Logger.start(true, "IP买家白名单#ListType1;NameType3;ScopeType1验证pass");
		try {
			Logger.comment("前置条件准备");
			initConfig();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			String name = urb.getClientIp();
			// 黑白名单都添加 优先走白名单
			insertNameList(2, 3, 1, name);
			insertNameList(1, 3, 1, name);
			// Thread.sleep(1000);
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("安全认证通过", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyNameList_016() {
		Logger.start(true, "设备号买家白名单#ListType1;NameType4;ScopeType1验证pass");
		try {
			Logger.comment("前置条件准备");
			initConfig();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			UserSafeWapper usw = new UserSafeWapper();
			String name = urb.getDeviceId();
			insertNameList(2, 4, 1, name);
			insertNameList(1, 4, 1, name);
			// Thread.sleep(1000);
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("安全认证通过", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	@Ignore
	// 用户编号白名单只有全局
	public void Tc_VerifyNameList_017() {
		Logger.start(true, "用户编号买手白名单#ListType1;NameType1;ScopeType2验证pass");
		try {
			Logger.comment("前置条件准备");
			initConfig();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setRegisterType(1);
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			UserSafeWapper usw = new UserSafeWapper();
			String name = uid.toString();
			String loginid = urb.getLoginId();
			insertNameList(2, 2, 2, loginid);
			insertNameList(1, 1, 2, name);
			// Thread.sleep(1000);
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("安全认证通过", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyNameList_018() {
		Logger.start(true, "登录名买手白名单#ListType1;NameType2;ScopeType2验证pass");
		try {
			Logger.comment("前置条件准备");
			initConfig();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setRegisterType(1);
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			UserSafeWapper usw = new UserSafeWapper();
			String name = urb.getLoginId();
			insertNameList(2, 2, 2, name);
			insertNameList(1, 2, 2, name);
			// Thread.sleep(1000);
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("安全认证通过", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyNameList_019() {
		Logger.start(true, "IP买手白名单#ListType1;NameType3;ScopeType2验证pass");
		try {
			Logger.comment("前置条件准备");
			initConfig();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setRegisterType(1);
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			UserSafeWapper usw = new UserSafeWapper();
			String name = urb.getClientIp();
			insertNameList(2, 3, 2, name);
			insertNameList(1, 3, 2, name);
			// Thread.sleep(1000);
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("安全认证通过", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyNameList_020() {
		Logger.start(true, "设备号买手白名单#ListType1;NameType4;ScopeType2验证pass");
		try {
			Logger.comment("前置条件准备");
			initConfig();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setRegisterType(1);
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			UserSafeWapper usw = new UserSafeWapper();
			String name = urb.getDeviceId();
			insertNameList(2, 4, 2, name);
			insertNameList(1, 4, 2, name);
			// Thread.sleep(1000);
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("安全认证通过", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyNameList_021() {
		Logger.start(true, "用户编号全局白名单#ListType1;NameType1;ScopeType0验证pass");
		try {
			Logger.comment("前置条件准备");
			initConfig();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setRegisterType(1);
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			UserSafeWapper usw = new UserSafeWapper();
			String name = uid.toString();
			String did = urb.getDeviceId();
			insertNameList(2, 4, 0, did);
			insertNameList(1, 1, 0, name);
			// Thread.sleep(1000);
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("安全认证通过", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyNameList_022() {
		Logger.start(true, "登录名全局白名单#ListType1;NameType2;ScopeType0验证pass");
		try {
			Logger.comment("前置条件准备");
			initConfig();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			UserSafeWapper usw = new UserSafeWapper();
			String name = urb.getLoginId();
			insertNameList(2, 2, 1, name);
			insertNameList(1, 2, 0, name);
			// Thread.sleep(1000);
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("安全认证通过", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyNameList_023() {
		Logger.start(true, "IP全局白名单#ListType1;NameType3;ScopeType0验证pass");
		try {
			Logger.comment("前置条件准备");
			initConfig();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			String name = urb.getClientIp();
			insertNameList(2, 3, 0, name);
			insertNameList(1, 3, 0, name);
			// Thread.sleep(1000);
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("安全认证通过", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyNameList_024() {
		Logger.start(true, "设备号全局白名单#ListType1;NameType4;ScopeType0验证pass");
		try {
			Logger.comment("前置条件准备");
			initConfig();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setRegisterType(1);
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			UserSafeWapper usw = new UserSafeWapper();
			String name = urb.getDeviceId();
			insertNameList(2, 4, 0, name);
			insertNameList(2, 4, 1, name);
			insertNameList(2, 4, 2, name);
			insertNameList(1, 4, 0, name);
			// Thread.sleep(1000);
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("安全认证通过", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyNameList_025() {
		Logger.start(true, "用户编号买家黑名单#ListType2;NameType1;ScopeType1有效期未到验证pass");
		try {
			Logger.comment("前置条件准备");
			initConfig();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			UserSafeWapper usw = new UserSafeWapper();
			String name = uid.toString();

			Date start = YMTDateUtil.getDate(YMTDateUtil.getBeforeOrNextDay(1, YMTDateUtil.YMDTHMSS_STRING), YMTDateUtil.YMDTHMSS_STRING);
			Date end = YMTDateUtil.getDate(YMTDateUtil.getBeforeOrNextDay(2, YMTDateUtil.YMDTHMSS_STRING), YMTDateUtil.YMDTHMSS_STRING);

			insertNameList(2, 1, 1, name, start, end);
			// Thread.sleep(1000);
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("安全认证通过", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyNameList_026() {
		Logger.start(true, "登录名全局黑名单#ListType2;NameType2;ScopeType0有效期过期验证pass");
		try {
			Logger.comment("前置条件准备");
			initConfig();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			UserSafeWapper usw = new UserSafeWapper();
			String name = urb.getLoginId();

			Date start = YMTDateUtil.getDate(YMTDateUtil.getBeforeOrNextDay(-2, YMTDateUtil.YMDTHMSS_STRING), YMTDateUtil.YMDTHMSS_STRING);
			Date end = YMTDateUtil.getDate(YMTDateUtil.getBeforeOrNextDay(-1, YMTDateUtil.YMDTHMSS_STRING), YMTDateUtil.YMDTHMSS_STRING);

			insertNameList(2, 2, 1, name, start, end);
			// Thread.sleep(1000);
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("200", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("true", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(200, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("安全认证通过", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyNameList_027() {
		Logger.start(true, "IP买家白名单#ListType1;NameType3;ScopeType1有效期未到验证block");
		try {
			Logger.comment("前置条件准备");
			initConfig();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			String name = urb.getClientIp();
			// 黑白名单都添加 优先走白名单
			insertNameList(2, 3, 1, name);
			Date start = YMTDateUtil.getDate(YMTDateUtil.getBeforeOrNextDay(1, YMTDateUtil.YMDTHMSS_STRING), YMTDateUtil.YMDTHMSS_STRING);
			Date end = YMTDateUtil.getDate(YMTDateUtil.getBeforeOrNextDay(2, YMTDateUtil.YMDTHMSS_STRING), YMTDateUtil.YMDTHMSS_STRING);
			insertNameList(1, 3, 1, name, start, end);
			// Thread.sleep(1000);
			verifyBean = initVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(140, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("IP黑名单，执行身份认证", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_VerifyNameList_028() {
		Logger.start(true, "设备号买手白名单#ListType1;NameType4;ScopeType2有效期过期验证block");
		try {
			Logger.comment("前置条件准备");
			initConfig();
			UserRegisterInfoRequestDtoBean urb = JUserCallService.initUserRegisterInfoRequestDtoBean();
			urb.setRegisterType(1);
			UserRegisterInfoRequestDtoCall uc = JUserCallService.UserRegisterInfoRequestDtoCall(urb);
			Integer uid = uc.getUserid();

			UserSafeWapper usw = new UserSafeWapper();
			String name = urb.getDeviceId();
			insertNameList(2, 4, 2, name);

			Date start = YMTDateUtil.getDate(YMTDateUtil.getBeforeOrNextDay(-2, YMTDateUtil.YMDTHMSS_STRING), YMTDateUtil.YMDTHMSS_STRING);
			Date end = YMTDateUtil.getDate(YMTDateUtil.getBeforeOrNextDay(-1, YMTDateUtil.YMDTHMSS_STRING), YMTDateUtil.YMDTHMSS_STRING);

			insertNameList(1, 4, 2, name, start, end);
			// Thread.sleep(1000);
			verifyBean = initSellerVerify(verifyBean, urb, uid);
			verifyCall.setData(verifyBean);
			verifyCall.callService();
			Logger.verifyEquals("100", verifyCall.getString("ErrorCode"), "验证code");
			Logger.verifyEquals("false", verifyCall.getString("Success"), "验证Success");
			Logger.verifyEquals(162, verifyCall.getCode(), "验证code");
			Logger.verifyEquals("设备号黑名单，执行身份认证", verifyCall.getAuthMessage(), "验证AuthMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}